#ifndef MYIIC_H
#define MYIIC_H
#include "main.h"
#include "delay.h"

#define iic_scl IIC1_SCL_Pin
#define iic_sda IIC1_SDA_Pin

#define H       1
#define L       0

#define SCL_Write(i)  HAL_GPIO_WritePin(GPIOB, iic_scl, (i) ? GPIO_PIN_SET : GPIO_PIN_RESET)
#define SDA_Write(i)  HAL_GPIO_WritePin(GPIOB, iic_sda, (i) ? GPIO_PIN_SET : GPIO_PIN_RESET)

#define IIC_Read_SDA  HAL_GPIO_ReadPin(GPIOB ,  iic_sda)

void IIC_Start(void);
void IIC_Stop(void);
int8_t IIC_Wait_Ack(int16_t timeout);
uint8_t IIC_Read_Byte(uint8_t ack); 
void IIC_Send_Byte(uint8_t txd);

#endif
